﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>集成坐席工作台UI</title>
    <!-- IM sdk样式文件，不使用IM插件不要加载此文件-->
    <link rel="stylesheet" type="text/css" href="@ViewBag.CssUrl">
    <!-- 软电话sdk样式文件-PC端（使用IM插件也得加载） -->
    <link rel="stylesheet" type="text/css" href="//g.alicdn.com/cloudcallcenter/web-workbench-sdk/3.3.0/ui.min.css">
</head>
<body>
    <div style="display: flex;justify-content: center;align-items: center;height: auto;">
        <div id="workbench"></div>
    </div>
    <!-- IM sdk js文件，不使用IM插件不要加载此文件-->
    <script src="@ViewBag.ScriptUrl"></script>
    <!-- 软电话sdk js文件（使用IM插件也得加载） -->
    <script src="//g.alicdn.com/cloudcallcenter/web-workbench-sdk/3.3.0/ui.min.js"></script>
    <script>
        window.workbench = new window.CCCWorkbenchSDK({
            dom: 'workbench', // UI版本必填，且在 id为workbench-container的dom加载完成后初始化
            instanceId: '@ViewBag.InstanceId', // 填写真实的实例ID
            exportErrorOfApi: true,
            afterCallRule: 15, // 话后处理时长
            ajaxPath: '/Ccc/sseApi', // 根据后端接口地址更改
            ajaxMethod: "post",
            //ajaxHeaders:{'Content-Type': 'application/x-www-form-urlencoded'},
            isEnableSwitchAdapter: false, //为提高坐席语音通话质量，新增多个接入点语音专线，默认为true。如果坐席需要直连云呼服务器，可设置为false。
            logger: {
                builtinEnabled: true,
            },
            imConfig: {
                getContainer() {
                    return document.getElementById('im-container');
                },
            },
            onInit() {
                console.log('onInit');
            },
            onRegister(event) {
                console.log('onRegister', event);
            },
            onLogIn(event) {
                console.log('onLogIn', event);
            },
            onBreak(event) {
                console.log('onBreak', event);
            },
            onChangeInvisibility(event) {
                console.log('onChangeInvisibility', event);
            },
            onReady() {
                console.log('onReady');
            },
            onCallComing(event) {
                console.log('onCallComing', event);
            },
            onCallDialing(event) {
                console.log('onCallDialing', event);
            },
            onCallEstablish(event) {
                console.log('onCallEstablish', event);
            },
            onCallRelease(event) {
                console.log('onCallRelease', event);
            },
            onDeviceTypeChange(event) {
                console.log('onDeviceTypeChange', event);
            },
            onErrorNotify(event) {
                console.log('onErrorNotify', event);
            },
            onHangUp(event) {
                console.log('onHangUp', event);
            },
            onLogOut() {
                console.log('onLogOut');
            },
            onSelectOutboundNumber(event) {
                console.log('onSelectOutboundNumber', event);
            },
            onStatusChange(event) {
                console.log('onStatusChange', event);
            },
            onWorkModeChange(event) {
                console.log('onWorkModeChange', event);
            },
            onBeforeCallDialing(payload) {
                console.log('onBeforeCallDialing', payload);
                payload.callback(); // 必须调用
            },
            onBeforeCallHangup(payload) {
                console.log('onBeforeCallHangup', payload);
                payload.callback();
            },
            onAgentStats(event) {
                console.log('onAgentStats', event);
            },
            onSelectCurrentCallRecord(event) {
                console.log('onSelectCurrentCallRecord', event);
            },
            onAfterEarlyMediaRecognized(event) {
                console.log('onAfterEarlyMediaRecognized', event);
            },
            onSignedSkillGroupChange(signedSkillGroupList) {
                console.log('onSignedSkillGroupChange', signedSkillGroupList);
            },
            onBeingMonitored(event) {
                console.log('onBeingMonitored', event);
            },
            onIvrTrackingAISummary(event) {
                console.log('onIvrTrackingAISummary', event);
            }
        });
        //window.CCCWorkbenchSDK.addListener('onInit', () => { console.log('实例已经初始化') })
    </script>
</body>
</html>